package com.heima.feigns;
//import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.WemediaFeignFallback;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.model.wemedia.pojos.WmUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(
        value = "leadnews-wemedia",
        fallbackFactory = WemediaFeignFallback.class,
        configuration = HeimaFeignAutoConfiguration.class
)
public interface WemediaFeign {
    @GetMapping("/api/v1/user/findByName/{name}")
    public int findByName(@PathVariable  String name);


    /**
     * 保存一条自媒体用户信息
     * 数据为1则保存成功
     * @param wmUser
     * @return
     */
    @PostMapping("/api/v1/user/save")
    public ResponseResult save(@RequestBody WmUser wmUser);


    //===================== 新增接口  start ====================
    @GetMapping("/api/v1/news/one/{id}")
    public ResponseResult<WmNews> updateNews(@PathVariable Integer id);
    @PutMapping("/api/v1/news/update")
    public ResponseResult updateWmNews(@RequestBody WmNews wmNews);
    //===================== 新增接口 end ====================
}